package com.example.designpatterns.behavioral.observer;

/**
 * 客户端代码（具体使用）
 *
 * @author scott
 */
public class Client {

    public static void main(String[] args) {
        ConcreteSubject subject = new ConcreteSubject();

        ConcreteObserver observer1 = new ConcreteObserver("Observer 1");
        ConcreteObserver observer2 = new ConcreteObserver("Observer 2");

        subject.registerObserver(observer1);
        subject.registerObserver(observer2);

        subject.notifyObservers();

        subject.unregisterObserver(observer2);

        subject.notifyObservers();
    }

}
